package com.yang.action;

import java.util.List;
import java.util.Map;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Result;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.yang.entity.Group;
import com.yang.entity.User;
import com.yang.service.GroupService;

public class AdminAction extends ActionSupport{

	private static final long serialVersionUID = 1507857898205669908L;
	private Map<String,Object> session= ActionContext.getContext().getSession();

	private User user;
	private List<Group> list;
	private GroupService gs=new GroupService();
	@Action(value="admin",results={@Result(name=SUCCESS,location="admin.jsp")})
	@Override
	public String execute() throws Exception {
		user=(User) session.get("user");
		String id=user.getId();
		list=gs.findAll(id);
		return SUCCESS;
	}
	public List<Group> getList() {
		return list;
	}
	public void setList(List<Group> list) {
		this.list = list;
	}

}
